package com.pi.shisan.service.util;

import com.pi.shisan.component.util.SingleThreadRunner;

public class SingleThreadCreator {

    private volatile static SingleThreadRunner VACATION_REFRESHER;
    private volatile static SingleThreadRunner VOLUME_TRAN;
    private volatile static SingleThreadRunner AUDIO_MANAGER;

    public static SingleThreadRunner getVacationRefresher() {
        if (VACATION_REFRESHER == null) {
            synchronized (SingleThreadRunner.class) {
                if (VACATION_REFRESHER == null) {
                    VACATION_REFRESHER = new SingleThreadRunner("vacation-refresh");
                }
            }
        }
        return VACATION_REFRESHER;
    }

    public static SingleThreadRunner getVolumeTran() {
        if (VOLUME_TRAN == null) {
            synchronized (SingleThreadRunner.class) {
                if (VOLUME_TRAN == null) {
                    VOLUME_TRAN = new SingleThreadRunner("volume-tran");
                }
            }
        }
        return VOLUME_TRAN;
    }

    public static SingleThreadRunner getAudioManager() {
        if (AUDIO_MANAGER == null) {
            synchronized (SingleThreadRunner.class) {
                if (AUDIO_MANAGER == null) {
                    AUDIO_MANAGER = new SingleThreadRunner("audio-manager");
                }
            }
        }
        return AUDIO_MANAGER;
    }

}
